package org.ticketing.model;

import java.sql.Date;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;


public class PersistenceTest {
	  
	public static void main(String[] args) {
	  System.out.println("Unit test JPA ");  
	  
	  EntityManagerFactory factory = Persistence.createEntityManagerFactory("DB");
	  EntityManager manager = factory.createEntityManager();
	  
	  
//	  User andrea = new User("andrea", "xxx");
//	  User matteo = new User("matteo", "xxx");
//	  User chiara = new User("chiara", "xxx");
//	  User alessandra = new User("alessandra", "xxx");

	  User pluto = new User("pluto7", "pwd", "Mario", "Rossi", Date.valueOf("1990-05-02"), 'M', "mariorossi@alice.it");
	  
	  manager.getTransaction().begin();
	  
//	  manager.persist(andrea);
//	  manager.persist(matteo);
//	  manager.persist(chiara);
//	  manager.persist(alessandra);

	  manager.persist(pluto);
	  
	  manager.getTransaction().commit();
	}
}
